<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="调账单" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/css/BillEdit.css" />
<script src="/js/popup_ext.js"></script>
<script src="/js/jquery.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function doSave(contFlag){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		document.getElementById("continue_flag").value=contFlag;
		<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';ADJU_EXAM;')!=-1}">
			ShowConfirm('确认框','是否同时审核？',340,80,"doSaveExt('"+contFlag+"')");
		</c:if>
		<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';ADJU_EXAM;')==-1}">
			<c:if test="${id==null || id==''}">
				if(contFlag!='NEW'){
					ShowConfirm('确认框','是否现在打印？',340,80,"doSavePrint()");
				}else{
					frm.submit();
				}
			</c:if>
			<c:if test="${id!=null && id!=''}">
				frm.submit();
			</c:if>
		</c:if>
	}
	function doSaveExt(contFlag){
		if(popRetVal!=null){
			document.getElementById("examine").value="1";
		}else{
			document.getElementById("examine").value="0";
		}
		<c:if test="${id==null || id==''}">
			if(contFlag!='NEW'){
				ShowConfirm('确认框','是否现在打印？',340,80,"doSavePrint()");
			}else{
				frm.submit();
			}
		</c:if>
		<c:if test="${id!=null && id!=''}">
			frm.submit();
		</c:if>
	}
	function doSavePrint(){
		if(popRetVal!=null){
			var printFlag;
			if(window.opener){
				printFlag="SHOW";
			}else{
				printFlag="CALLBACK";
			}
			document.getElementById("print_flag").value=printFlag;
		}
		frm.submit();
	}
	function doCancel(){
		if(window.opener){
			window.close();
		}else{
			var retVal="${retVal}";
			if(retVal!=""){
				parent.popRetVal=retVal;
			}
			parent.ClosePop();
		}
	}
	function doZero(index){
		document.getElementById("this_cost_"+index).value="0";
		checkItemChange(index);
	}
	function doFull(index){
		document.getElementById("this_cost_"+index).value=document.getElementById("remain_cost_"+index).value;
		checkItemChange(index);
	}
	function selectClient(){
		var adjustType="${command.adjustBill.adjustType}";
		var tsId="${command.adjustBill.tallySetId}";
		var url;
		if(adjustType=="PAY_ADD" || adjustType=="PAY_ABATE" || adjustType=="PUR_BACK_ADD" || adjustType=="PUR_BACK_ABATE"){
			var billType;
			if(adjustType=="PAY_ADD" || adjustType=="PAY_ABATE"){
				billType="BUY";
			}else{
				billType="BACK";
			}
			url="/base/EstablishmentListForSelect.ihtm?type=PROVIDER&order_type=BUS_TIME&ts_id="+tsId;
		}else if(adjustType=="COLLECT_ADD" || adjustType=="COLLECT_ABATE"){
			url="/base/EstablishmentListForSelect.ihtm?type=CLIENT&order_type=BUS_TIME&ts_id="+tsId;
		}else if(adjustType=="COO_ADD" || adjustType=="COO_ABATE"){
			url="/base/EstablishmentListForSelect.ihtm?type=COOPERATOR&order_type=BUS_TIME&ts_id="+tsId;
		}
		ShowIframe("选择调帐单位",url,900,500,"selectClientCallBack()",1024,600);
	}
	function selectClientCallBack(){
		if(popRetVal!=null){
			$("#LoadProcess").css("top",getTopPos(document.getElementById("clientName"))+50+"px");
			$("#LoadProcess").css("left",getleftPos(document.getElementById("clientName"))+100+"px");
			$("#LoadProcess").show();
			
			document.getElementById("adjustBill.clientId").value=popRetVal[0];//名字带点jquery不认
			document.getElementById("clientName").value=popRetVal[1];
			if(popRetVal[2]!="0"){
				document.getElementById("adjustBill.managerId").value=popRetVal[2];
				document.getElementById("adjustBill.managerName").value=popRetVal[3];
			}
			
			var estId=popRetVal[0];
			var tsId="${command.adjustBill.tallySetId}";
			var adjustType="${command.adjustBill.adjustType}";
			if(adjustType=="PAY_ADD" || adjustType=="PAY_ABATE" || adjustType=="PUR_BACK_ADD" || adjustType=="PUR_BACK_ABATE"){
				var billType;
				if(adjustType=="PAY_ADD" || adjustType=="PAY_ABATE"){
					billType="BUY";
				}else{
					billType="BACK";
				}
				$.post("/finance/GetPurcForPay.ihtm",{est_id:estId,ts_id:tsId,bill_type:billType},function(data,status){
					parseItemData(data,status);
				});
			}else if(adjustType=="COLLECT_ADD" || adjustType=="COLLECT_ABATE"){
				$.post("/finance/GetBusiForRece.ihtm",{est_id:estId,ts_id:tsId},function(data,status){
					parseItemData(data,status);
				});
			}else if(adjustType=="COO_ADD" || adjustType=="COO_ABATE"){
				$.post("/finance/GetCoopForPay.ihtm",{est_id:estId,ts_id:tsId},function(data,status){
					parseItemData(data,status);
				});
			}
		}
	}
	function parseItemData(data,status){
		if(status=="success"){
			var obj=$.parseJSON(data);
			if(obj.status=="ERROR"){
				$("#LoadProcess").hide();
				ShowAlert('提示框',obj.errMsg,200,100);
			}else{
				var tbl=$("#itemRowTbl");
				var itemNum=$("#item_num").val()-0;
				var i;
				for(var i=0;i<itemNum;i++){
					$("#itemTr"+i).hide();
					$("#status_"+i).val("DELETE");
				}
				
				$("#item_num").val(obj.items.length+itemNum);
				
				$.each(obj.items,function(index,item){
					var rowInd=index+itemNum;
					var tr=$("<tr></tr>");
					tr.prop({"id":"itemTr"+rowInd,"class":"ListTr"});
					
					var td;
					var input;
			
					td=$("<td></td>");
					input=$("<input type='text' name='business_bill_code_"+rowInd+"' id='business_bill_code_"+rowInd+"' class='TextBox readonly' readonly='readonly' />");
					input.prop("index",rowInd);//自定义的属性要显式设置,否则后面用prop取不出来(写在上面的字符串的话,只能用attr才取得到)
					input.css("width","110px");
					input.val(item.code);
					td.append(input);
					
					input=$("<input type='hidden' name='business_bill_id_"+rowInd+"' id='business_bill_id_"+rowInd+"' />");
					input.val(item.id);
					td.append(input);
					
					input=$("<input type='hidden' name='id_"+rowInd+"' id='id_"+rowInd+"' />");
					input.val("0");
					td.append(input);
					
					input=$("<input type='hidden' name='status_"+rowInd+"' id='status_"+rowInd+"' />");
					input.val("NEW");
					td.append(input);
					tr.append(td);
					
					td=$("<td></td>");
					input=$("<input type='text' name='order_date_"+rowInd+"' id='order_date_"+rowInd+"' class='TextBox readonly' readonly='readonly' />");
					input.prop("index",rowInd);
					input.css("width","70px");
					input.val(item.date);
					td.append(input);
					tr.append(td);
					
					td=$("<td></td>");
					input=$("<input type='text' name='content_"+rowInd+"' id='content_"+rowInd+"' class='TextBox readonly' readonly='readonly' />");
					input.prop("index",rowInd);
					input.css("width","200px");
					input.val(item.cont);
					td.append(input);
					tr.append(td);
					
					td=$("<td></td>");
					input=$("<input type='text' name='total_cost_"+rowInd+"' id='total_cost_"+rowInd+"' class='TextBox readonly' readonly='readonly' />");
					input.prop("index",rowInd);
					input.css("width","62px");
					input.val(item.totaCost);
					td.append(input);
					tr.append(td);
					
					td=$("<td></td>");
					input=$("<input type='text' name='remain_cost_"+rowInd+"' id='remain_cost_"+rowInd+"' class='TextBox readonly' readonly='readonly' />");
					input.prop("index",rowInd);
					input.css("width","62px");
					input.val(item.remaCost);
					td.append(input);
					tr.append(td);
					
					td=$("<td></td>");
					input=$("<input type='text' name='this_cost_"+rowInd+"' id='this_cost_"+rowInd+"' class='TextBox' maxlength='10' />");
					input.prop("index",rowInd);
					input.css("width","62px");
					input.val("0");
					td.append(input);
					td.append(" ");
					input=$("<input type='button' />");
					input.prop("index",rowInd);
					input.val("不调");
					input.css=("font-size","12px");
					input.click(function(){
						doZero($(this).prop("index"));
					});
					td.append(input);
					td.append(" ");
					input=$("<input type='button' />");
					input.prop("index",rowInd);
					input.val("全调");
					input.css=("font-size","12px");
					input.click(function(){
						doFull($(this).prop("index"));
					});
					td.append(input);
					tr.append(td);
					
					tbl.append(tr);
				});
				
				doCount();
				resizePopwin();
				setFocus("costStr");
				$("#LoadProcess").hide();
			}
		}else{
			$("#LoadProcess").hide();
			ShowAlert('提示框','系统错误：'+status,200,100);
		}
	}
	
	function doCount(){
		var itemNum=Number(document.getElementById("item_num").value);
		var costTotal=0;
		var itemCost;
		for(var i=0;i<itemNum;i++){
			if(document.getElementById("status_"+i).value!="DELETE"){
				itemCost=document.getElementById("this_cost_"+i).value;
				if(!isNaN(itemCost)){
					costTotal=addMul(costTotal,itemCost);
				}
			}
		}
		document.getElementById("costStr").value=costTotal;
	}
	function checkItemChange(index){
		if(document.getElementById("id_"+index).value=="" || document.getElementById("id_"+index).value=="0"){
			document.getElementById("status_"+index).value="NEW";
		}else{
			document.getElementById("status_"+index).value="EDIT";
		}
	}
	function selectStaffer(){
		var url="/base/StafferMainForSelect.ihtm";
		ShowIframe("选择员工",url,800,500,"selectStafferCallBack()",1024,600);
	}
	function selectStafferCallBack(){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById("adjustBill.managerId").value=arr[0];
			document.getElementById("adjustBill.managerName").value=arr[1];
			var depObj=document.getElementById("adjustBill.departmentId");
			for(var i=0;i<depObj.options.length;i++){
				if(arr[2]==depObj.options[i].value){
					depObj.options[i].selected=true;
					break;
				}
			}
		}
	}
	function autoAssign(){
		var cost=document.getElementById("costStr").value;
		var itemNum=Number(document.getElementById("item_num").value);
		var i;
		for(i=0;i<itemNum;i++){
			var status=document.getElementById("status_"+i).value;
			if(status!="DELETE"){
				var remainCost=Number(document.getElementById("remain_cost_"+i).value);
				if(remainCost<0){
					remainCost=0-remainCost;
				}
				if(Number(cost)<=remainCost){
					document.getElementById("this_cost_"+i).value=cost;
					cost=0;
				}else{
					cost=abateMul(cost,remainCost);
					document.getElementById("this_cost_"+i).value=remainCost;
				}
				checkItemChange(i);
			}
		}
	}
	function doPrint(id){
		showWin(900,600,"/finance/AdjustBillPrint.ihtm?id="+id);
	}
	function doInit(){
		showFormErrorMsg();
		resizePopwin();
		document.getElementById("costStr").focus();
	}
	function doWinUnload(){
		var retVal='${retVal}';
		if(retVal!='' && !window.opener){
			parent.popRetVal=retVal;
		}
	}
</script>
</head>
<body onload="doInit();" onUnload="doWinUnload();">
<div class="Wrap">
	<form name="frm" method="post">
	<div class="Container">
		<div class="Contnet Paper">
			<c:set var="pageTopTitle" value="调账单" />
			<c:if test="${command.adjustBill.enabled=='N' || currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';ADJU_BILL;')==-1 || id!=null && id!='' && command.adjustBill.examined=='Y'}">
				<c:set var="disabledStr" value="disabled='true'" />
			</c:if>
			
			<c:set var="codeDisabledStr" value="" />
  			<c:set var="codeReadOnlyClassStr" value="" />
			<c:if test="${command.codeRule.generateRule!='MANUAL'}">
      			<c:set var="codeReadOnlyStr" value="readonly='readonly'" />
				<c:set var="codeReadOnlyClassStr" value="disabled" />
      		</c:if>
			
			<c:set var="dateEdit" value="Y" /><!-- 是否可以编辑日期 -->
			<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_BILL_DATE;')!=-1}">
				<c:set var="dateEdit" value="N" />
			</c:if>

			<!-- 提示信息 -->
			<%@ include file="../inc/BillPageTop.jsp"%>

			<!--单 标题-->
			<br>
	        <table class="BillHeading" cellspacing="0" cellpadding="0">
	        	<tr>
		            <td width="301px;" rowspan="2" ><div class="CorpLogo"><img src="${enterpriseInfo.loginImage}" /></div></td>
		            <td width="301px;" rowspan="2" ><h1>${pageTopTitle}</h1></td>
		            <td width="301px;" class="tr vb codeTd">
		                <span class="MustInput">*</span>编号：
		                <spring:bind path="command.adjustBill.billCode">
				    	<input type="text" class="tbBillCode TextBox ${codeReadOnlyClassStr}" ${codeReadOnlyStr} maxlength="30" onKeyUp="goNextInput('adjustDateStr');" id="${status.expression}" name="${status.expression}" value="${status.value}">
				    	<script language="javascript">
							setFormErrorMsg('<c:out value="${status.errorMessage}" />',1,'adjustBill.billCode');
						</script>
			     		</spring:bind>
		            </td>
	        	</tr>
	        	<tr>
	            	<td class="tr">
	            		<span id="calPosi"></span>
		            	<span class="MustInput">*</span>调账日期：
		            	<spring:bind path="command.adjustDateStr">
		                    <input type="text" class="tbBillDate_sim TextBox <c:if test="${dateEdit=='N'}">readonly</c:if>" maxlength="15" id="${status.expression}" name="${status.expression}" value="${status.value}" <c:if test="${dateEdit=='N'}">readonly="readonly"</c:if> />
		                    <c:if test="${dateEdit=='Y'}"><img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('adjustDateStr'),'yyyy-mm-dd',document.getElementById('calPosi'));"></c:if>
		                    <script language="javascript">
						    	setFormErrorMsg('<c:out value="${status.errorMessage}" />',2,'adjustDateStr');
						    </script>
		                </spring:bind>
	            	</td>
	        	</tr>
	        </table>

			<!-- 单 头信息 -->
	        <div class="TopBottom_Border">
	        	<table class="BillHeadInfo" cellspacing="0" cellpadding="0">
	        		<tr>
	            		<td width="284px">
	                		<span class="MustInput">*</span>调账单位：
	                		<spring:bind path="command.clientName">
	                    	<input class="TextBox readonly" style="width:150px" readonly="readonly" type="text" id="${status.expression}" name="${status.expression}" value="${status.value}">
					      	<c:if test="${id==null || id=='')}"><img class="imgIconButton" src="/images/make-a.gif" onClick="selectClient();"></c:if>
	                		</spring:bind>
	                		<spring:bind path="command.adjustBill.clientId">
	                    	<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
	                    	<script language="javascript">
				          		setFormErrorMsg('<c:out value="${status.errorMessage}" />',3);
				          	</script>
	                		</spring:bind>
	            		</td>
	            		<th width="84px"><span class="MustInput">*</span>调账金额：</th>
	                	<td width="273px">
	                		<spring:bind path="command.costStr">
	                    	<input type="text" class="tbHead3 TextBox" maxlength="10" id="${status.expression}" name="${status.expression}" value="${status.value}" onChange="autoAssign();">
	                    	<script language="javascript">
						    	setFormErrorMsg('<c:out value="${status.errorMessage}" />',5,'costStr');
						    </script>
	                		</spring:bind>
	            		</td>
	            		<td width="263px;" class="tr">
	                		调账类型：
	                		<c:if test="${command.adjustBill.adjustType=='COLLECT_ADD'}">应收款增加</c:if>
							<c:if test="${command.adjustBill.adjustType=='COLLECT_ABATE'}">应收款减少</c:if>
							<c:if test="${command.adjustBill.adjustType=='PAY_ADD'}">采购付款金额增加</c:if>
							<c:if test="${command.adjustBill.adjustType=='PAY_ABATE'}">采购付款金额减少</c:if>
							<c:if test="${command.adjustBill.adjustType=='PUR_BACK_ADD'}">采购退货金额增加</c:if>
							<c:if test="${command.adjustBill.adjustType=='PUR_BACK_ABATE'}">采购退货金额减少</c:if>
							<c:if test="${command.adjustBill.adjustType=='COO_ADD'}">外协金额增加</c:if>
							<c:if test="${command.adjustBill.adjustType=='COO_ABATE'}">外协金额减少</c:if>
	            		</td>
	        		</tr>
	        	</table>
	        </div>

			<!-- 明细 -->
	        <input type="hidden" id="item_num" name="item_num" value="${fn:length(command.items)}">
	        <table id="BillDetails" class="BillDetails" width="100%" cellspacing="0" cellpadding="0">
	        	<tbody id="itemRowTbl">
				<tr>
					<th width="16%">单号</th>
					<th width="12%">日期</th>
					<th width="28%" >摘要</th>
					<th width="10%">金额（元）</th>
					<th width="10%">余额（元）</th>
					<th width="24%">本次调账</th>
				</tr>
				<c:forEach var="item" items="${command.items}" varStatus="i">
				<c:set var="trStyle" value="" />
				<c:if test="${item.status=='DELETE'}"><c:set var="trStyle" value="style='display:none'" /></c:if>
				<tr id="itemTr${i.index}" ${trStyle}>
					<td >
						<input type="text" class="TextBox readonly" readonly="readonly" style="width:110px;" maxlength="50" id="business_bill_code_${i.index}" name="business_bill_code_${i.index}" value="${item.adjustBillItem.businessBillCode}">
						<input type="hidden" id="business_bill_id_${i.index}" name="business_bill_id_${i.index}" value="${item.adjustBillItem.businessBillId}">
						<input type="hidden" id="id_${i.index}" name="id_${i.index}" value="${item.oldId}">
						<input type="hidden" id="status_${i.index}" name="status_${i.index}" value="${item.status}">
					</td>
					<td >
						<input type="text" class="TextBox readonly" readonly="readonly" style="width:70px;" id="order_date_${i.index}" name="order_date_${i.index}" value="<fmt:formatDate value="${item.adjustBillItem.orderDate}" pattern="yyyy-MM-dd"/>">
					</td>
					<td >
						<input type="text" class="TextBox readonly" readonly="readonly" style="width:200px;" id="content_${i.index}" name="content_${i.index}" value='<c:out value="${item.adjustBillItem.content}" />'>
					</td>
					<td >
						<input type="text" class="TextBox readonly" readonly="readonly" style="width:62px;" id="total_cost_${i.index}" name="total_cost_${i.index}" value='<commonTag:parseBigDecimal source="${item.adjustBillItem.totalCost}" />'>
					</td>
					<td >
						<input type="text" class="TextBox readonly" readonly="readonly" style="width:62px;" id="remain_cost_${i.index}" name="remain_cost_${i.index}" value='<commonTag:parseBigDecimal source="${item.adjustBillItem.remainCost}" />'>
					</td>
					<td >
						<input type="text" class="TextBox" style="width:62px;" maxlength="10" id="this_cost_${i.index}" name="this_cost_${i.index}" value="${item.thisCostStr}" onChange="checkItemChange(${i.index});">
						<input type="button" style="font-size:12px;" value="不调" onClick="doZero(${i.index});">
						<input type="button" style="font-size:12px;" value="全调" onClick="doFull(${i.index});">
					</td>
				</tr>
				</c:forEach>
				</tbody>
			</table>
			<div class="table-bot" style="height:20px;">
				<span style="float:right;PADDING-RIGHT:10px;color:#aaa;">
					<input type="button" style="font-size:12px;" value="汇总到调账金额" onClick="doCount();">
				</span>
				&nbsp;
			</div>
			<br>
			<spring:bind path="command.items">
	        	<script language="javascript">
	          		setFormErrorMsg('<c:out value="${status.errorMessage}" />',6);
	        	</script>
	    	</spring:bind>

			<!-- 附加信息 -->
	        <div class="TopBottom_Border">
	        	<table class="BillElseInfo" cellspacing="0" cellpadding="0">
	        		<tr>
	        			<th width="84px"><span class="MustInput">*</span>经办人：</th>
	            		<td width="200px">
	            			<spring:bind path="command.adjustBill.managerName">
	            			<input type="text" class="tbInfo1 TextBox readonly" readOnly="true" id="${status.expression}" name="${status.expression}" value="${status.value}" />
                			<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStaffer();"/>
            				<script language="javascript">
								setFormErrorMsg('<c:out value="${status.errorMessage}" />',7);
							</script>
            				</spring:bind>
            				<spring:bind path="command.adjustBill.managerId">
                			<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
            				</spring:bind>
	            		</td>
	            		<th width="84px"><span class="MustInput">*</span>部门：</th>
	            		<c:set var="depEditDisabledStr" value="${editDisabledStr}" />
			            <c:if test="${fn:indexOf(currentUser.privs,';NO_BILL_DEPA;')!=-1}">
			                <c:set var="depEditDisabledStr" value="disabled='disabled'" />
			            </c:if>
	            		<spring:bind path="command.adjustBill.departmentId">
	            		<td width="273px">
	            			<select id="${status.expression}" name="${status.expression}" class="ddlInfo3_long" ${depEditDisabledStr} <c:if test="${depEditDisabledStr!=''}">style='background:#f6f6f6;'</c:if>>
                    			<option value="0">==请选择==</option>
                    			<commonTag:createSelectTree list="${departmentList}" emptyOption="0" defaultValue="${status.value}" />
                			</select>
            				<script language="javascript">
						    	setFormErrorMsg('<c:out value="${status.errorMessage}" />',8);
						    </script>
	            		</td>
	            		</spring:bind>
	            		<th width="84px"></th>
            			<td width="179px"></td>
	        		</tr>
	        		<tr>
        				<th>摘要：</th>
        				<spring:bind path="command.adjustBill.description">
        				<td colspan="5">
        					<textarea class="TextBox" name="${status.expression}" id="${status.expression}" style="width:764px;height:40px"><c:out value="${status.value}" /></textarea>
            				<script language="javascript">
						    	setFormErrorMsg('<c:out value="${status.errorMessage}" />',9,'adjustBill.description');
						    </script>
        				</td>
        				</spring:bind>
        			</tr>
        			<tr>
        				<th>备注：</th>
        				<spring:bind path="command.adjustBill.mark">
        				<td colspan="5">
        					<textarea class="TextBox" name="${status.expression}" id="${status.expression}" style="width:764px;height:40px"><c:out value="${status.value}" /></textarea>
            				<script language="javascript">
						    	setFormErrorMsg('<c:out value="${status.errorMessage}" />',10,'adjustBill.mark');
						    </script>
        				</td>
        				</spring:bind>
        			</tr>
    			</table>
    		</div>
			<br>
			<div class="BillNotes">
                <span>开单人：${command.adjustBill.createrName} <c:if test="${command.adjustBill.createTime!=null}"><fmt:formatDate value="${command.adjustBill.createTime}" pattern="yyyy-MM-dd HH:mm"/></c:if></span>
	        	<span>审核人：<c:if test="${command.adjustBill.examinerId!=0}">${command.adjustBill.examinerName} <c:if test="${command.adjustBill.examineTime!=null}"><fmt:formatDate value="${command.adjustBill.examineTime}" pattern="yyyy-MM-dd HH:mm"/></c:if></c:if></span>
	        	<span>单据帐套：${command.tallySetName}</span>
				<spring:bind path="command.adjustBill.tallySetId">
			    	<script language="javascript">
			        	setFormErrorMsg('<c:out value="${status.errorMessage}" />',1);
			    	</script>
				</spring:bind>
			</div>

		</div>
		
		<!-- 底栏按钮 -->
		<div class="Footer">
			<div id="buttonDiv">
				<input type="hidden" id="examine" name="examine" value="0">
				<c:if test="${id!=null && id!=''}">
					<input type="button" class="buttom-a" value=" 打 印 " onClick="doPrint(${id});" <c:if test="${command.adjustBill.enabled=='N'}">disabled='true'</c:if>>
				</c:if>
				<input type="button" class="buttom-a" value=" 保 存 " onClick="doSave('');" ${disabledStr}>
				<c:if test="${id==null || id==''}">
					<input type="button" class="buttom-a" value="保存并新增" onClick="doSave('NEW');" ${disabledStr}>
				</c:if>
				<!--
				<input type="button" class="buttom-a" value="向下分配" onClick="autoAssign();">
				<input type="button" class="buttom-a" value="向上汇总" onClick="doCount();">
				-->
				<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();">
				<input type="hidden" name="continue_flag" id="continue_flag" value="">
				<input type="hidden" name="print_flag" id="print_flag" value="">
				<spring:bind path="command.sychronizeValue"><input type="hidden" name="${status.expression}" value="${status.value}"></spring:bind>
			</div>
			<div id="waitDiv" style="display:none">
    			<span>请稍候...</span>
			</div>
		</div>

	</div>
	</form>
</div>
<%@ include file="../inc/LoadingDiv.jsp"%>
</body>
</html>
